package com.ruoyi.store.feign;

import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;

import com.ruoyi.store.domain.TbCoupon;
import com.ruoyi.store.domain.TbCouponRecord;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.*;

import java.text.ParseException;

@FeignClient(contextId = "couponFeignClient", value = ServiceNameConstants.COUPON_SERVICE)
public interface CouponClient {

    @GetMapping(value = "/coupon/list")
    public TableDataInfo list(@SpringQueryMap TbCoupon tbCoupon);


    @PutMapping(value = "/coupon/{couponId}/{openId}")
    public AjaxResult receiveCoupon(@PathVariable("couponId") Long couponId,@PathVariable("openId") String openId) throws ParseException;

    @GetMapping("/coupon/myCoupon")
    public TableDataInfo selectMyCoupon(@SpringQueryMap TbCouponRecord tbCouponRecord);

    @PostMapping("/couponRecord/useCoupon")
    public AjaxResult useCoupon(@RequestBody TbCouponRecord tbCouponRecord);

}
